<template>
	<view class="museum" :style="{paddingTop:searchBarTop + 44 + 'px'}">
		<view class="nav_bar">
			<uni-nav-bar statusBar fixed :border="false" left-icon="left" @clickLeft="back"></uni-nav-bar>
		</view>
		<!-- <view class="banner">
			<image src="/static/home/bowuguan.png" mode=""></image>
		</view>
		<view class="desc">
			<image src="/static/home/jieshao.png" mode=""></image>
			<view class="">
				文案介绍文案介绍文案介绍文案介绍文案介绍文案介绍文案介绍文案介绍文案介绍文案介绍文案介绍文案介绍文案介绍文案介绍文案介绍文案介绍文案介绍
			</view>
		</view>
		<view class="activity_title">
			<image src="/static/home/huodong.png" mode=""></image>
		</view> -->
		<image src="../static/hlj.jpg" mode="widthFix" class="img-750" />
		<view class="activity_list">
			<productList :list="list" :noMoreData="noMoreData"></productList>
		</view>

	</view>
</template>

<script>
	import productList from "@/components/productList/productList.vue"
	export default {
		components: {
			productList
		},
		data() {
			return {
				page: 1,
				lastPage: 1,
				noMoreData: false,
				list: [],
				searchBarTop: 0,
				
			};
		},
		onShow() {
			this.getSystem();
			this.getActivities()
		},
		onReachBottom() {
			if (this.page < this.lastPage) {
				this.page += 1
				this.getActivities()
			} else {
				this.noMoreData = true
			}
		},
		methods: {
			getSystem() {
				uni.getSystemInfo({
					success: (e) => {
						this.searchBarTop = e.statusBarHeight;
					}
				})
			},
			// async getImg() {
			// 	// 0首页 1研学 2冬夏令营 3红领巾 4托管 5心理测评
			// 	const res = await this.$api.get(`image/get/3`, {});
			// 	console.log(res, "红领巾")
			// 	if (res.code == 200) {
			// 		this.topMsg = res.data
			// 	}
			// },
			async getActivities() {
				const res = await this.$api.get('competition/week/list', {
					activity: 5, //活动 0=赛事, 1=党建，2=团建，3=研学产品，4=冬夏令营，5=红领巾博物馆 6=托管服务
					page: this.page,
					limit: 10,
					type: 0, //0=本周 1=往期
				});
				console.log(res, "红领巾博物馆")
				if (res.code == 200) {
					const {
						list,
						totalPage
					} = res.data
					if (this.page == 1) {
						this.list = list || [];
						this.lastPage = totalPage || 1;
					} else {
						this.list.push(...list);
					}
					this.page != 1 && list.length == 0 ? this.noMoreData = true : this.noMoreData = false
				}
			},
		}
	}
</script>

<style lang="scss">
	page {
		// background-color: #FFEC91;
		// background-color: #e3e3d9;
		background-color: #FFF;
	}
	.img-750 {
		display: block;
		margin: 0 auto;
		width: 100vw;
		height: auto;
		margin-bottom: 40rpx;
	}
	.museum {
		.nav_bar {
			width: 100%;
			position: fixed;
			top: 0;
			left: 0;
			right: 0;
			z-index: 99;

			/deep/.uni-navbar {
				// opacity: 0;
				.uni-navbar__content {
					background-color: transparent !important;

					.uni-navbar__header {
						background-color: transparent !important;
					}
				}
			}

			.back_btn {
				width: 54rpx;
				height: 54rpx;
				border-radius: 50%;
				display: flex;
				justify-content: center;
				align-items: center;
				background-color: rgba(0, 0, 0, 0.4);
			}
		}

		.banner {
			width: 100%;
			height: 646rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.desc {
			width: 100%;
			height: 300rpx;
			padding: 0 26rpx;
			box-sizing: border-box;
			position: relative;

			image {
				width: 100%;
				height: 100%;
			}

			>view {
				width: 100%;
				height: 100%;
				position: absolute;
				left: 0;
				right: 0;
				bottom: 0;
				top: 0;
				z-index: 2;
				padding: 104rpx 52rpx 0;
				box-sizing: border-box;
				font-size: 24rpx;
				font-weight: bold;
				color: #43AE8E;
				line-height: 32rpx;
			}
		}

		.activity_title {
			display: flex;
			justify-content: center;
			padding: 26rpx 0 30rpx;

			image {
				width: 200rpx;
				height: 76rpx;
			}
		}

		.activity_list {
			width: 100%;
			padding: 0 26rpx 30rpx;
			box-sizing: border-box;
		}
	}
</style>